package com.xur.springboot.controller;

import com.xur.springboot.entity.User;
import com.xur.springboot.entity.employee;
import com.xur.springboot.service.EmployeeService;
import com.xur.springboot.utils.ResultVO;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class EmployeeController {

    @Resource
    private EmployeeService employeeService;

    //在鸿蒙前端获取数据时需要解析JSON数据
    //直接返回json数据
    @GetMapping("/eeInfo")
    public List<employee> queryEmployee(){
        System.out.println("请求了简历列表");
        return employeeService.queryEmployee();
    }

    @GetMapping("/eeInfoById")
    public List<employee> queryEEdetailById(@RequestParam int id){
        System.out.println("根据id请求了简历列表"+id);
        return employeeService.queryEEdetailById(id);
    }

    @GetMapping("/eeInfoByUser_Id")
    public List<employee> queryEEdetailByUser_Id(@RequestParam int user_id){
        System.out.println("根据user_id请求了简历列表"+user_id);
        return employeeService.queryEEdetailByUser_Id(user_id);
    }

    @GetMapping("/insertEeInfo")
    public int insertEmployee(employee employee){
        System.out.println("根据id请求了简历列表"+employee);
        return employeeService.insertEmployee(employee);
    }

    @GetMapping("/updateEeInfo")
    public int updateEmployee(employee employee) {
        System.out.println("更新简历信息: " + employee);
        return employeeService.updateEmployee(employee);
    }

}
